package com.example.task1.ui.AllService.parking;


import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;

import com.example.task1.bean.NewsClassBean;
import com.example.task1.bean.ParkingNewsSortBean;
import com.example.task1.common.BaseRvFragment;

import java.util.ArrayList;
import java.util.List;

public class ParkingTabAdapter extends FragmentPagerAdapter {

    private List<ParkingNewsSortBean.DataDTO> mDate = new ArrayList<>();

    public ParkingTabAdapter(@NonNull FragmentManager fm) {
        super(fm);
    }

    public void setData(List<ParkingNewsSortBean.DataDTO> date){
        mDate = date;
        notifyDataSetChanged();
    }

    @NonNull
    @Override
    public Fragment getItem(int position) {
        return new ParkingBaseRvFragment().newInstance(mDate.get(position).getId() + "", "");
    }

    @Override
    public int getCount() {
        return mDate == null ? 0 : mDate.size();
    }

    @Nullable
    @Override
    public CharSequence getPageTitle(int position) {
        return mDate.get(position).getName();
    }


}
